<?php
include '../conn.php';
if(!isset($_GET['page'])){
    $arr = [
        "desc" => "缺少参数"
    ];
    echo json_encode($arr);
    exit;
}
$page = $_GET['page'] * 10;
$sql = "select a.id,b.nickname,a.title,a.images,a.type,a.update_time from users_content as a
        left join users_info as b
        on a.user_id = b.id
        where a.status = 1
        order by id desc
        limit $page,10";
$req = $pdo->getAll($sql);
$arr = array();
foreach($req as $res):
    $imgs = preg_split("/[,]+/",$res['images']);
    $imgarr = array();
    foreach($imgs as $img):
        array_push(
            $imgarr,[
                "content" => "$url$img"
            ]
        );
    endforeach;
    array_push(
        $arr,[
            "id" => $res['id'],
            "nickname" => $res['nickname'],
            "title" => "$res[title]",
            "images" => $imgarr,
            "type" => "$res[type]",
            "time" => "$res[update_time]"
        ]
    );
endforeach;

echo json_encode($arr);
exit;